/*
1. if two side of balance are even, so all coins on the balance is True Coin
2. if two side of balance are not even, so all coins which is no on the balance is True Coin
3. if one coins in Heavy side and while in other test case, it is in the light side, this coin is True Coin
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>

#ifndef FILEIO
#define main1013 main
#endif

#define UNKNOWN 4
#define EVEN 3
#define LIGHT 2
#define HEAVY 1
int array[26] = {0};
void mark(char *a)
{
  assert(a != NULL);
  int len = strlen(a);
  for(int i = 0;i<len;i++)
    {
      array[a[i] - 'A'] = EVEN;
    }
}

void markup(char *a,int upordown)
{
  assert(a != NULL);
  assert((upordown == LIGHT)||(upordown == HEAVY)); 
  int len = strlen(a);
  for(int i = 0;i<len;i++)
    {
      if(array[a[i] - 'A'] == 0) 
        array[a[i] - 'A'] = upordown;
      else if(array[a[i] - 'A'] == LIGHT && upordown == HEAVY) 
        {
          array[a[i] - 'A'] = EVEN;
        }
      else if(array[a[i] - 'A'] == HEAVY && upordown == LIGHT) 
        {
          array[a[i] - 'A'] = EVEN;          
        }
    }
}

int IsContain(char *a,char b)
{
  assert(a != NULL);
  int len = strlen(a);
  for(int i = 0;i<len;i++)
    {
      if(a[i] == b)
        return 0;
    }
  return -1;
}

void markeven(char *a,char *b)
{
  assert(a != NULL);
  assert(b != NULL);
  for(int i = 0;i < 12;i++)  
    {
      if(!(IsContain(a,(char)i + 'A') == 0 ||IsContain(b,(char)i + 'A') == 0))
        array[i] = EVEN;
    }
}

int main1013(int argc,char **argv) 
{ 

#ifdef FILEIO
  freopen("1013in.txt","r",stdin); 
  freopen("1013out.txt","w",stdout); 
#endif

  int N;


#define SIZE 10
  char a[SIZE];
  char b[SIZE];
  char c[SIZE];

  const char *even = "even";
  const char *up = "up";
  const char *down = "down"; 
  scanf("%d\n",&N);

  for(int i=0;i<N;i++)
    {
      memset(a,0,SIZE*sizeof(char));
      memset(b,0,SIZE*sizeof(char));
      memset(c,0,SIZE*sizeof(char));
	  memset(array,0,26*sizeof(int));

      for(int j = 0;j<3;j++)
        {
          scanf("%s %s %s",a,b,c);

          if(strcmp(even,c) == 0) 
            {
              mark(a);
              mark(b);
            }
          else if(strcmp(up,c) == 0) 
            {
              markup(a,HEAVY);
              markup(b,LIGHT);
              markeven(a,b);
            }
          else if(strcmp(down,c) == 0) 
            {
              markup(a,LIGHT);
              markup(b,HEAVY);
              markeven(a,b);
            }
        }
      for(int i = 0;i <= 12;i++)
        {
          if(array[i] != 0 && array[i] != EVEN)
            {
              printf("%c is the counterfeit coin and it is %s.\n",
                     i + 'A', array[i] == LIGHT? "light":"heavy"); 
            }
        }
    }


#ifdef FILEIO
  fclose(stdin);
  fclose(stdout);
#endif  
  
  return 0; 
}
